<?php
class EventCommentsController extends EventsAppController {

	var $name = 'EventComments';
	var $helpers = array('Html', 'Form');
	/*
	function index() 
	{
		$this->EventComment->recursive = 0;
		$this->set('eventComments', $this->paginate());
	}
	
	function view($id = null) 
	{
		$eventComment = $this->EventComment->read(null, $id);
		if (!$id || empty($eventComment)) 
		{
			$this->errorMsg(__('Invalid URL', true));
			$this->redirect(array('action' => 'index'));
		}
		$this->set('eventComment', $eventComment);
	}
	
	function add($eventId=null) 
	{
		if (!empty($this->data)) 
		{
			$this->EventComment->create();
			if ($this->EventComment->save($this->data)) {
				// commented as this is now handled by counterCache 
				// $this->redirect(array('plugin'=>'events','controller'=>'events','action'=>'increase_comment_count',$eventId));
				$this->successMsg(__('Comment has been saved successfully', true));
				$this->redirect(array('plugin'=>'events','controller'=>'events','action' => 'view',$eventId));
			} else {
				$this->errorMsg(__('Comment could not be saved. Please, try again.', true));
			}
		}
		$events = $this->EventComment->Event->find('list');
		$users = $this->EventComment->User->find('list');
		$this->set(compact('events', 'users'));
	}

	function edit($id = null) 
	{
		$eventComment = $this->EventComment->read(null, $id);
		if (!$id && empty($eventComment)) 
		{
			$this->errorMsg(__('Invalid URL', true));
			$this->redirect(array('action' => 'index'));
		}
		if (!empty($this->data)) 
		{
			if ($this->EventComment->save($this->data)) {
				$this->successMsg(__('Comment has been saved successfully', true));
				//$this->redirect(array('action' => 'index'));
				$this->redirect(array('plugin'=>'events','controller'=>'events','action' => 'view',$eventComment['EventComment']['event_id']));
			} else {
				$this->errorMsg(__('Comment could not be saved. Please, try again.', true));
			}
		}
		if (empty($this->data)) {
			$this->data = $eventComment;
		}
		$events = $this->EventComment->Event->find('list');
		$users = $this->EventComment->User->find('list');
		$this->set(compact('events','users'));
	}
	
	function delete($id = null) {
		if (!$id) {
			$this->errorMsg(__('Invalid URL', true));
			$this->redirect(array('action' => 'index'));
		}
		if ($this->EventComment->del($id)) {
			$this->successMsg(__('Comment deleted', true));
			$this->redirect(array('action' => 'index'));
		}
		$this->successMsg(__('Comment could not be deleted. Please, try again.', true));
		$this->redirect(array('action' => 'index'));
	}
	*/
}
?>